package com.yunxi.service.dubboService.impl.activiti;

import com.github.pagehelper.PageInfo;
import com.yunxi.activiti.pojo.ActivitiTypeVO;
import com.yunxi.activiti.service.ActivitiTypeDubboService;
import com.yunxi.model.activiti.ActivitiType;
import com.yunxi.model.company.Company;
import com.yunxi.service.localService.activiti.ActivitiTypeService;
import com.yunxi.service.localService.company.CompanyService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/1/25.
 */
@Service
public class ActivitiTypeDubboServiceImpl implements ActivitiTypeDubboService {

    @Autowired
    @Qualifier(value = "companyServiceImpl")
    CompanyService companyService;
    @Autowired
    @Qualifier(value = "activitiTypeServiceImpl")
    ActivitiTypeService activitiTypeService;

    @Override
    public List<ActivitiTypeVO> findActivitiTypesList() {
        return activitiTypeService.findActivitiTypesList();
    }


    @Override
    public ActivitiTypeVO findByFromType(String fromType) {
        return activitiTypeService.findByFromType(fromType);
    }

    @Override
    public List<ActivitiTypeVO> listCas(Map<String, Object> map) {
        System.out.println("222");
        return activitiTypeService.listCas(map);
    }

    @Override
    public ActivitiTypeVO getById(Long id) throws InvocationTargetException, IllegalAccessException {
        ActivitiType activitiType = activitiTypeService.getById(id);
        ActivitiTypeVO activitiTypeVO = new ActivitiTypeVO();
        BeanUtils.copyProperties(activitiType,activitiTypeVO);
        return activitiTypeVO;
    }

    @Override
    public void saveOrUpdate(ActivitiTypeVO activitiTypeVO) throws InvocationTargetException, IllegalAccessException {
        ActivitiType activitiType =new ActivitiType();
        BeanUtils.copyProperties(activitiTypeVO,activitiType);
        activitiTypeService.saveOrUpdate(activitiType);
    }

    @Override
    public void removeById(Long id) {
        activitiTypeService.removeById(id);
    }

    @Override
    public PageInfo<ActivitiTypeVO> findPageByVO(ActivitiTypeVO activitiTypeVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
        PageInfo<ActivitiTypeVO> pageInfo = activitiTypeService.pageByVo(activitiTypeVO,pageNum,pageSize);
        return pageInfo;
    }

    @Override
    public void removeByListVo(List<ActivitiTypeVO> activitiTypeVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        activitiTypeService.removeByListVo(activitiTypeVOList);
    }

    @Override
    public List listByVo(ActivitiTypeVO activitiTypeVO) {
        return activitiTypeService.listByVo(activitiTypeVO);
    }
}
